name: Cancel

env:
  # Force the stdout and stderr streams to be unbuffered
  PYTHONUNBUFFERED: 1

on: # yamllint disable-line rule:truthy
  workflow_run:
    workflows: ["PullRequestCI", "ReleaseBranchCI", "DocsCheck", "BackportPR"]
    types:
      - requested
jobs:
  cancel:
    runs-on: [self-hosted, style-checker]
    steps:
      - uses: styfle/cancel-workflow-action@0.9.1
        with:
          all_but_latest: true
          workflow_id: ${{ github.event.workflow.id }}
